package cn.hchaojie.camp.day04;

public class Demo2DArray {
	public static void main(String[] args) {
		int[][] scores = {
				{11, 12, 13, 14, 15},		// scores[0]
				{21, 22, 23, 24, 25},		// scores[1]
				{31, 32, 33, 34, 35},		// scores[2]
		};
		
		int[] line1 = scores[0];		// 第一行
		
		// r == row		c == column
		for (int r = 0; r < scores.length; r++) {
			for (int c = 0; c < scores[r].length; c++) {
				System.out.print(scores[r][c] + "\t");
			}
			
			System.out.println();
		}
		
		System.out.println();
		
		// 从下往上，从左往右
		for (int r = scores.length - 1; r >= 0; r--) {
			for (int c = 0; c < scores[r].length; c++) {
				System.out.print(scores[r][c] + "\t");
			}
			
			System.out.println();
		}
		
		System.out.println();
		
		// 从下往上，从右往左
		for (int r = scores.length - 1; r >= 0; r--) {
			for (int c = scores[r].length - 1; c >= 0; c--) {
				System.out.print(scores[r][c] + "\t");
			}
			
			System.out.println();
		}
		
		System.out.println();
		
//		int[][] scores = {
//				{11, 12, 13, 14, 15},		// scores[0]
//				{21, 22, 23, 24, 25},		// scores[1]
//				{31, 32, 33, 34, 35},		// scores[2]
		
//		11	21	31	
//		12	22	32	
//		13	23	33	
//		14	24	34	
//		15	25	35	
//		
//		31	21	11	
//		32	22	12	
//		33	23	13	
//		34	24	14	
//		35	25	15	
		
//		};
		// 31, 21, 11
		
		System.out.println();
		for (int r = 0; r < scores[0].length; r++) {
			for (int c = 0; c < scores.length; c++) {
				System.out.print(scores[c][r] + "\t");
			}
			
			System.out.println();
		}
		
		for (int r = 0; r < scores[0].length; r++) {
			for (int c = scores.length - 1; c >= 0; c--) {
				System.out.print(scores[c][r] + "\t");
			}
			
			System.out.println();
		}

	}
}
